package cn.wolfcode.trip.admin.controller;

import cn.wolfcode.trip.base.domain.SpecificArea;
import cn.wolfcode.trip.base.query.QueryObject;
import cn.wolfcode.trip.base.service.IRegionService;
import cn.wolfcode.trip.base.service.ISpecificAreaService;
import cn.wolfcode.trip.base.service.IStrategyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/specificArea")
public class SpecificAreaController {
    @Autowired
    private ISpecificAreaService specificAreaService;
    @Autowired
    private IRegionService regionService;
    @Autowired
    private IStrategyService strategyService;
    @RequestMapping("/list")
    public String list(Model model, QueryObject qo){
        model.addAttribute("pageInfo",specificAreaService.selectAll(qo));
        model.addAttribute("regions",regionService.queryForAll());
        model.addAttribute("strategies",strategyService.selectAll());
        return "specificArea/list";
    }
    @RequestMapping("/update")
    private String saveOrUpdate(SpecificArea specificArea){
        specificAreaService.update(specificArea);
        return "redirect:/specificArea/list.do";
    }
}
